home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Revolution - Das Atari CD Magazin 1997
/
Revolution - Das Atari CD Magazin 1.iso
/
software
/
anwendng
/
qed_397
/
sourcen
/
dial.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-10-15
|
1KB
|
79 lines
/*
* dial.c
* Listenverwaltung für Dialoge
*
*/
#include <stdlib.h>
#include "global.h"
#include "set.h"
#include "dial.h"
LOCAL DIALP dial_list;
LOCAL WORD dial_anz;
LOCAL SET used_dials;
GLOBAL DIALP new_dial(VOID)
{
DIALP d_ptr, d2;
WORD i;
d_ptr = (DIALP)malloc(sizeof(DIAL_INF)); /* neues Element anlegen */
if (d_ptr != NULL)
{
dial_anz++;
for (i = dial_anz; (--i) >= 0; )
{
if (!setin(used_dials, i))
break;
}
if (i < 0)
return NULL;
setincl(used_dials, i);
d_ptr->link = i;
d_ptr->next = NULL;
d2 = dial_list; /* An Ende anhängen */
while (d2 != NULL)
d2 = d2->next;
d2->next = d_ptr;
}
return d_ptr;
}
GLOBAL VOID destruct_dial(WORD link)
{
DIALP d_ptr, d2;
d_ptr = get_dial(link);
if (d_ptr != NULL)
{
d2 = dial_list; /* Aus Liste aushängen */
while (d2->next != d_ptr)
d2 = d2->next;
d2->next = d_ptr->next;
free(d_ptr);
setexcl(used_dials, link);
}
}
GLOBAL DIALP get_dial(WORD icon)
{
DIALP d_ptr;
if (icon == -1)
return NULL;
for (d_ptr = dial_list; d_ptr != NULL; d_ptr = d_ptr->next)
if (d_ptr->link == icon)
break;
return d_ptr;
}
GLOBAL VOID init_dial(VOID)
{
dial_list = NULL;
dial_anz = 0;
setclr(used_dials);
}